<%
  #File:    /app/views/manage/metadata/user_contact_types.rhtml
  #Author:  Andrew Stone
  #Created: 09.11.2006
%>

<%=error_messages_for("user_contact_type")%>

<%=start_form_tag(:action => "user_contact_types")%>
<%=start_large_div_wrapper%>
  <div id="page_title">User Contact Types</div>
  <div id="large">
    <table>
      <thead>
        <tr>
          <td>Name</td>
          <td>Format Type</td>
          <td>Active?</td>
          <td>Required?</td>
          <td>Actions</td>
        </tr>
      </thead>
      <tbody>
      <%
        i = 0
        UserContactType.find(:all, :order => "name").each{|uct| 
          bg = row_class(i)
          i += 1
          if @mode == "update" && @user_contact_type.id == uct.id%>
            <%=render(:partial => "update_user_contact_type", :locals => {:bg => bg})%><%
          else %>
            <%=render(:partial => "show_user_contact_type", :locals => {:bg => bg, :uct => uct})%><%
          end 
        }
        bg = row_class(i)
        if @mode == "create"%>
          <%=render(:partial => "update_user_contact_type", :locals => {:bg => bg})%><%
        end 
      %>
      </tbody>
    </table>
    <%
      if @mode == "update" %>
      <%=hidden_field("user_contact_type","id")%><%
      end
    %>
    <%=hidden_field_tag("mode",@mode)%>
    <div id="actions">
      <%
        if !(@mode == "list")%>
          <%=submit_tag("Cancel")%><%
        end 

        if @mode == "update" || @mode == "create"%>
          <%=submit_tag("Save")%> <%
        else %>
          <%=submit_tag("Create")%> <%
        end
      %>
    </div>
  </div>
<%=end_div_wrapper%>
<%=end_form_tag%>
 
